#pragma once

#include <windows.h>
#include <assert.h>

LONG WINAPI GenerateDump(struct _EXCEPTION_POINTERS *pExceptionPointers);


#ifdef _DEBUG
#define CHECK(CODE) \
	__try\
	{\
		CODE;\
	}\
	__except(GenerateDump(GetExceptionInformation()))\
	{\
		assert(false);\
	}
#else
#define CHECK(CODE) \
	__try\
	{\
		CODE;\
	}\
	__except(GenerateDump(GetExceptionInformation()))\
	{\
		int* p = NULL;\
		*p = -1;\
	}
#endif